import { NIcon } from "naive-ui";
import { Component, h } from "vue";
import {
  LogOutOutline,
  PersonOutline,
  BookOutline,
  WineOutline,
  StarOutline,
  NotificationsOutline,
  SettingsOutline,
  Menu,
  PlaySkipBackSharp,
  PlaySkipForward,
  InformationCircleOutline,
  Language,
  Refresh,
  Albums,
  ApertureSharp,
  Layers,
  ExtensionPuzzle,
  ServerSharp,
} from "@vicons/ionicons5";
import {
  FullScreenMaximize24Regular,
  FullScreenMinimize24Regular,
  BookLetter24Regular,
  CheckboxIndeterminate24Regular,
  Dismiss24Regular,
  DismissCircle24Regular,
  CaretDown24Filled,
  ExpandUpLeft24Filled,
  ArrowMove24Regular,
  ArrowMoveInward20Regular,
  WeatherSunny24Regular,
  WeatherMoon24Regular,
  Delete24Regular,
  Edit24Regular,
  QuestionCircle24Regular,
  ConferenceRoom24Filled,
  WindowDevTools24Filled,
} from "@vicons/fluent";

export function renderIcon(icon: Component) {
  return () => h(NIcon, null, { default: () => h(icon) });
}

export const LogOutOutlineIcon = renderIcon(LogOutOutline);
export const PersonOutlineIcon = renderIcon(PersonOutline);
export const BookOutlineIcon = renderIcon(BookOutline);
export const WineOutlineIcon = renderIcon(WineOutline);
export const StarOutlineIcon = renderIcon(StarOutline);
export const NotificationsOutlineIcon = renderIcon(NotificationsOutline);
export const SettingsIcon = renderIcon(SettingsOutline);
export const MenuIcon = renderIcon(Menu);
export const BackwardIcon = renderIcon(PlaySkipBackSharp);
export const ForwardIcon = renderIcon(PlaySkipForward);
export const InformationIcon = renderIcon(InformationCircleOutline);
export const LanguageIcon = renderIcon(Language);
export const RefreshIcon = renderIcon(Refresh);
export const AlbumsIcon = renderIcon(Albums);
export const ApertureIcon = renderIcon(ApertureSharp);
export const LayersIcon = renderIcon(Layers);
export const ExtensionIcon = renderIcon(ExtensionPuzzle);
export const ServerIcon = renderIcon(ServerSharp);

export const FullScreenIcon = renderIcon(FullScreenMaximize24Regular);
export const ResumeScreenIcon = renderIcon(FullScreenMinimize24Regular);
export const BookLetterIcon = renderIcon(BookLetter24Regular);
export const CloseOthersIcon = renderIcon(CheckboxIndeterminate24Regular);
export const CloseCircleIcon = renderIcon(DismissCircle24Regular);
export const DismissIcon = renderIcon(Dismiss24Regular);
export const CaretDownIcon = renderIcon(CaretDown24Filled);
export const ExpandUpLeftIcon = renderIcon(ExpandUpLeft24Filled);
export const ArrowMoveIcon = renderIcon(ArrowMove24Regular);
export const ArrowMoveInwardIcon = renderIcon(ArrowMoveInward20Regular);
export const SunIcon = renderIcon(WeatherSunny24Regular);
export const MoonIcon = renderIcon(WeatherMoon24Regular);
export const DeleteIcon = renderIcon(Delete24Regular);
export const EditIcon = renderIcon(Edit24Regular);
export const QuestionIcon = renderIcon(QuestionCircle24Regular);
export const ConferenceRoomIcon = renderIcon(ConferenceRoom24Filled);
export const DevToolsIcon = renderIcon(WindowDevTools24Filled);

const icons = {
  LogOutOutlineIcon,
  PersonOutlineIcon,
  BookOutlineIcon,
  WineOutlineIcon,
  StarOutlineIcon,
  NotificationsOutlineIcon,
  SettingsIcon,
  MenuIcon,
  BackwardIcon,
  ForwardIcon,
  InformationIcon,
  LanguageIcon,
  RefreshIcon,
  AlbumsIcon,
  ApertureIcon,
  LayersIcon,
  ExtensionIcon,
  ServerIcon,

  FullScreenIcon,
  ResumeScreenIcon,
  BookLetterIcon,
  CloseOthersIcon,
  CloseCircleIcon,
  DismissIcon,
  CaretDownIcon,
  ExpandUpLeftIcon,
  ArrowMoveIcon,
  ArrowMoveInwardIcon,
  SunIcon,
  MoonIcon,
  DeleteIcon,
  EditIcon,
  QuestionIcon,
  ConferenceRoomIcon,
  DevToolsIcon,
};

export type ZIconName = keyof typeof icons;

export function getIconByName(name?: ZIconName) {
  if (!name) return undefined;
  return icons[name];
}
